package com.hzeport.bgs22emduty.inbound.lsapi;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzeport.assembly.hzeportIdem.annotaion.IdemAnnotation;
import com.hzeport.bgs22emduty.config.login.LoginCompoentService;
import com.hzeport.bgs22emduty.config.login.UserInfoDetailVO;
import com.hzeport.bgs22emduty.dto.*;
import com.hzeport.bgs22emduty.entity.DutyScheduleExchange;
import com.hzeport.bgs22emduty.service.BasePersonInfoService;
import com.hzeport.bgs22emduty.service.DutyScheduleExchangeService;
import com.hzeport.bgs22emduty.util.MessageSendUtil;
import com.hzeport.bgs22emduty.vo.DutyScheduleExchange.DutyScheduleExchangeListVO;
import com.hzeport.bgs22emduty.vo.DutyScheduleExchange.DutyScheduleExchangeSaveVO;
import com.hzeport.bgs22emduty.vo.DutyScheduleExchange.DutyScheduleExchangedetailVO;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@AllArgsConstructor
@RequestMapping("/dutyscheduleexchangels")
@Api(value = "dutyscheduleexchangels", tags = "大屏个人调班")
@Slf4j
@CrossOrigin
public class DutyScheduleExchangeLSController {
    @Resource
    private DutyScheduleExchangeService dutyScheduleExchangeService;
    @Resource
    private LoginCompoentService loginCompoentService;
    @Resource
    private BasePersonInfoService basePersonInfoService;


    @ApiOperation(value = "调班申请列表")
    @RequestMapping(value = "listls",method = RequestMethod.POST)
    public BaseResult<Page<DutyScheduleExchangeListVO>> listls(@RequestBody LSDutyScheduleExchangeDTO exchangeDTO){
        return dutyScheduleExchangeService.listls(exchangeDTO);
    }

//    @ApiOperation(value = "调班申请列表")
//    @RequestMapping(value = "listls",method = RequestMethod.GET)
//    public BaseResult<List<String>> listls(){B
//        return dutyScheduleExchangeService.listlsTest();
//    }

    @ApiOperation(value = "获取详情")
    @RequestMapping(value = "detaills",method = RequestMethod.POST)
    public BaseResult<DutyScheduleExchangedetailVO> detaills(@RequestBody LSDutyScheduleExchangeDeraillsDTO dto){
        return dutyScheduleExchangeService.detaills(dto);
    }

    @ApiOperation(value = "保存")
    @RequestMapping(value = "savels",method = RequestMethod.POST)
    @IdemAnnotation
    public BaseResult<DutyScheduleExchange> savels( @RequestBody DutyScheduleExchangeSaveVO dutyScheduleExchangeSaveVO , HttpServletRequest request) throws Exception {
        return dutyScheduleExchangeService.saveDatals(dutyScheduleExchangeSaveVO,request);
    }

    @ApiOperation(value = "调班确认，待确认列表")
    @RequestMapping(value = "listturels",method = RequestMethod.POST)
    public BaseResult<Page<DutyScheduleExchangeListVO>> listturels(@RequestBody DutyScheduleExchangeListTureDTO dto) throws Exception {
        return dutyScheduleExchangeService.listturels(dto);
    }

    @ApiOperation(value = "调班确认的接口")
    @RequestMapping(value = "turels",method = RequestMethod.POST)
    @IdemAnnotation
    public BaseResult<DutyScheduleExchange> turels(@RequestBody LSDutyScheduleExchangetureDTO dto, HttpServletRequest request) throws Exception {
        return dutyScheduleExchangeService.turels(dto,request);
    }


}
